import java.util.Objects;
//比较两个字符串
public class Test22 {
    public static void main(String[] args) {
        MyTime m2 =new MyTime(18,8,2020);//创建对象，传入数据
        MyTime m3 =new MyTime(18,8,2020);

        System.out.println(m2.toString());
    }
}
class MyTime{
    int day;
    int month;
    int year;

    public MyTime(){}
    //有参构造方法
    public MyTime(int day, int month, int year){
        this.day =day;
        this.month =month;
        this.year = year;
    }
    public String toString(){
        return this.year +"年"+this.month+"月"+this.day+"日";
    }
}
